Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set timezone on timezone-unaware test #524

Conversation

NortySpock
Copy link
Contributor

This test was failing on my machine with the following (but did not fail in the GH Action build):

code:  assert TimexHelper.date_to_str(@today) == "2013-12-04"
     left:  "2013-12-03"
     right: "2013-12-04"

Some brief investigation showed that the time calculation was 6 hours prior; which lines up with my current timezone, America/Chicago, or UTC -6:00.

code:  assert TimexHelper.date_to_str(@today, format: :ymd_hms) == "2013-12-04"
     left:  "2013-12-03 18:00:00"
     right: "2013-12-04"

Setting the timezone on the test to the same timezone specified when the initial time set up fixed the test failure. I think it would fix the test failure for all developers west of the selected timezone of Europe/London.

(Alternative option: if there was a way to set the timezone for the container doing the testing, this would also become a host-timezone-independent test.)

@NortySpock NortySpock force-pushed the fix-occasional-test-failure-due-to-not-being-timezone-aware branch from c52c544 to 1e3a4ab Compare November 13, 2024 13:00
@NortySpock NortySpock force-pushed the fix-occasional-test-failure-due-to-not-being-timezone-aware branch from 1e3a4ab to 99a5c67 Compare November 13, 2024 13:07
@L-e-x-o-n L-e-x-o-n merged commit efe75ee into beyond-all-reason:master Nov 16, 2024
3 checks passed
@NortySpock NortySpock deleted the fix-occasional-test-failure-due-to-not-being-timezone-aware branch November 18, 2024 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants